home *** CD-ROM | disk | FTP | other *** search
/ United States Naval Academy Annapolis, Maryland / United States Naval Academy - Annapolis, Maryland.iso / pc / navy data / modules / messagepro.k < prev    next >
Text File  |  2000-12-18  |  10KB  |  349 lines

  1. module oTokenProPlugin is cPlugin
  2. has
  3.  
  4.     release Editor:
  5.         GetIO()
  6.             do
  7.                 result := oIOTokenProPlugin;
  8.             end;
  9.     end;
  10. end;
  11.  
  12.  
  13. release Editor:
  14.  
  15.     object oIOTokenProPlugin is cIOPlugin
  16.     with
  17.         MenuItems is [
  18.             cIOArgumentInMenuItem with Name is "Message In 2"; Value is oMessageInArgument2In; end,
  19.             cIOArgumentInMenuItem with Name is "Message In 3"; Value is oMessageInArgument3In; end,
  20.             cIOArgumentInMenuItem with Name is "Message In 4"; Value is oMessageInArgument4In; end,
  21.             cIOArgumentInMenuItem with Name is "Message In 5"; Value is oMessageInArgument5In; end,
  22.             cIOArgumentInMenuItem with Name is "Message In 6"; Value is oMessageInArgument6In; end,
  23.             cIOArgumentInMenuItem with Name is "Message In 7"; Value is oMessageInArgument7In; end,
  24.             cIOArgumentInMenuItem with Name is "Message In 8"; Value is oMessageInArgument8In; end
  25.         ];
  26.         CommandLines is [
  27.             cIOSeedListLine 
  28.             with 
  29.                 Label is "Special";
  30.                 Lines is [
  31.                     cIOSeedLine with IO is oIOTokenProCommand; end
  32.                 ];
  33.             end
  34.         ];
  35.     end;
  36.  
  37. end;
  38.         
  39.  
  40.  
  41. class cTokenProCommand 
  42. is 
  43.     cTokenCommand;
  44. has
  45.     Value1;
  46.     Value2;
  47.     Value3;
  48.     Value4;
  49.     Value5;
  50.     Value6;
  51.     Value7;
  52.     Value8;
  53.     ParameterCount;
  54.     
  55.     EachParameter(DoToParameter, ...)
  56.         do
  57.             self.cTokenCommand:EachParameter(DoToParameter, ...);
  58.             self.DoToParameter(Value1, ...);
  59.             self.DoToParameter(Value2, ...);
  60.             self.DoToParameter(Value3, ...);
  61.             self.DoToParameter(Value4, ...);
  62.             self.DoToParameter(Value5, ...);
  63.             self.DoToParameter(Value6, ...);
  64.             self.DoToParameter(Value7, ...);
  65.             self.DoToParameter(Value8, ...);
  66.             self.DoToParameter(ParameterCount, ...);
  67.         end;
  68.         
  69.         
  70.         
  71.     ExecuteBroadcast(theContext)
  72.         use
  73.             aTarget;
  74.             aValue1;
  75.             aValue2;
  76.             aValue3;
  77.             aValue4;
  78.             aValue5;
  79.             aValue6;
  80.             aValue7;
  81.             aValue8;
  82.             aResult;
  83.         do
  84.             aTarget := self.CreateTarget();
  85.             aTarget.Initialize(self.Runtime, self);
  86.             aTarget.ID := self.GetElement();
  87.             aValue1 := self.Value1.Become(ANY, theContext);
  88.             aValue2 := self.Value2.Become(ANY, theContext);
  89.             aValue3 := self.Value3.Become(ANY, theContext);
  90.             aValue4 := self.Value4.Become(ANY, theContext);
  91.             aValue5 := self.Value5.Become(ANY, theContext);
  92.             aValue6 := self.Value6.Become(ANY, theContext);
  93.             aValue7 := self.Value7.Become(ANY, theContext);
  94.             aValue8 := self.Value8.Become(ANY, theContext);
  95.  
  96.             aResult := new cResult.WithValue(theContext, self.ValueRef);
  97.             self.Runtime.Broadcast(self.TokenRef.GetName(), aTarget, aValue1, aResult, aValue2, aValue3, aValue4, aValue5, aValue6, aValue7, aValue8);
  98.         end;
  99.         
  100.     ExecuteTarget(theElement, theContext)
  101.         use
  102.             aTarget;
  103.             aValue1;
  104.             aValue2;
  105.             aValue3;
  106.             aValue4;
  107.             aValue5;
  108.             aValue6;
  109.             aValue7;
  110.             aValue8;
  111.             aResult;
  112.         do
  113.             aTarget := self.CreateTarget();
  114.             aTarget.Initialize(self.Runtime, self);
  115.             aTarget.ID := self.GetElement();
  116.             aValue1 := self.Value1.Become(ANY, theContext);
  117.             aValue2 := self.Value2.Become(ANY, theContext);
  118.             aValue3 := self.Value3.Become(ANY, theContext);
  119.             aValue4 := self.Value4.Become(ANY, theContext);
  120.             aValue5 := self.Value5.Become(ANY, theContext);
  121.             aValue6 := self.Value6.Become(ANY, theContext);
  122.             aValue7 := self.Value7.Become(ANY, theContext);
  123.             aValue8 := self.Value8.Become(ANY, theContext);
  124.  
  125.             aResult := new cResult.WithValue(theContext, self.ValueRef);
  126.             self.(self.Mode)(theElement, aTarget, aValue1, aResult, aValue2, aValue3, aValue4, aValue5, aValue6, aValue7, aValue8);
  127.         end;
  128.     
  129.     
  130.     release Editor:
  131.  
  132.         GetIO()
  133.             do
  134.                 result := oIOTokenProCommand;
  135.             end;
  136.         
  137.     end;
  138. end;
  139.  
  140.  
  141. class cTokenProArgumentIn
  142. is
  143.     cArgumentIn;
  144. has
  145.  
  146.     GetValue(theContext)
  147.         do
  148.             if theContext.GetEvent() is? self.EventType then
  149.                 if theContext.ArgumentArray.Count() < self.ArgumentIndex then
  150.                     result := void;
  151.                 else
  152.                     result := theContext.GetArgument(self.ArgumentIndex);
  153.                 end;
  154.                 if result is? cResult then
  155.                     result := result.GetValue(theContext);
  156.                 end;
  157.             else
  158.                 theContext.ReportError(oKeyProgramErrorNumber, oArgumentMismatchError);
  159.             end;
  160.         end;
  161. end;
  162.  
  163. object oMessageInArgument2In is cTokenProArgumentIn
  164. with
  165.     ArgumentIndex is 5;
  166.     EventType is cTokenEvent;
  167.     Identifier is "oMessageInArgument2In";
  168. end;
  169.  
  170. object oMessageInArgument3In is cTokenProArgumentIn
  171. with
  172.     ArgumentIndex is 6;
  173.     EventType is cTokenEvent;
  174.     Identifier is "oMessageInArgument3In";
  175. end;
  176.  
  177. object oMessageInArgument4In is cTokenProArgumentIn
  178. with
  179.     ArgumentIndex is 7;
  180.     EventType is cTokenEvent;
  181.     Identifier is "oMessageInArgument4In";
  182. end;
  183.  
  184. object oMessageInArgument5In is cTokenProArgumentIn
  185. with
  186.     ArgumentIndex is 8;
  187.     EventType is cTokenEvent;
  188.     Identifier is "oMessageInArgument5In";
  189. end;
  190.  
  191.  
  192. object oMessageInArgument6In is cTokenProArgumentIn
  193. with
  194.     ArgumentIndex is 9;
  195.     EventType is cTokenEvent;
  196.     Identifier is "oMessageInArgument6In";
  197. end;
  198.  
  199. object oMessageInArgument7In is cTokenProArgumentIn
  200. with
  201.     ArgumentIndex is 10;
  202.     EventType is cTokenEvent;
  203.     Identifier is "oMessageInArgument7In";
  204. end;
  205.  
  206.  
  207. object oMessageInArgument8In is cTokenProArgumentIn
  208. with
  209.     ArgumentIndex is 11;
  210.     EventType is cTokenEvent;
  211.     Identifier is "oMessageInArgument8In";
  212. end;
  213.  
  214.  
  215. release Editor:
  216.  
  217.  
  218.     object oIOTokenProCommand is cIOLeafCommandLine
  219.     with
  220.         HelpURL is "Commands/Send_Message.htm";
  221.         Icon is "\$00\$1F\$00\$1F\$38\$03\$6C\$1B\$C6\$1B\$C6\$00\$CC\$30\$C8\$30\$48\$00\$64\$30\$32\$78\$19\$CC\$0C\$04\$06\$0C\$03\$F8\$00\$F0\$00\$1F\$00\$1F\$78\$0F\$FC\$1F\$FE\$3B\$FE\$30\$FC\$30\$F8\$30\$F8\$00\$7C\$30\$7E\$78\$3F\$FC\$1F\$FC\$0F\$FC\$07\$FC\$01\$F8\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$FF\$FF\$FF\$FF\$FF\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$FF\$FF\$FF\$FF\$FF\$00\$F6\$FB\$FB\$FB\$00\$00\$00\$00\$00\$00\$00\$F8\$F8\$FF\$FF\$F6\$FB\$FB\$F8\$FB\$FB\$00\$00\$00\$00\$00\$FF\$FF\$F8\$FF\$FF\$FB\$FB\$F8\$F6\$F8\$FB\$FB\$00\$00\$00\$F8\$FF\$FF\$00\$FF\$FF\$FB\$FB\$F8\$F6\$F8\$FB\$FB\$00\$00\$00\$F8\$F8\$00\$00\$00\$00\$FB\$FB\$F8\$F8\$FB\$FB\$00\$00\$00\$00\$FF\$FF\$00\$00\$00\$00\$FB\$FB\$F8\$F8\$FB\$00\$00\$00\$00\$00\$FF\$FF\$00\$00\$00\$00\$F8\$FB\$F8\$F8\$FB\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$00\$FB\$FB\$F8\$F8\$FB\$00\$00\$00\$00\$FB\$FB\$00\$00\$00\$00\$00\$F6\$FB\$FB\$F8\$F8\$FB\$00\$00\$FB\$FB\$FB\$FB\$00\$00\$00\$00\$00\$F6\$FB\$FB\$F8\$F8\$FB\$FB\$FB\$F8\$F8\$FB\$FB\$00\$00\$00\$00\$00\$F6\$FB\$FB\$F8\$F8\$F8\$F8\$F6\$F6\$F8\$FB\$00\$00\$00\$00\$00\$00\$F6\$FB\$FB\$F8\$F8\$F8\$F8\$F8\$FB\$FB\$00\$00\$00\$00\$00\$00\$00\$F6\$FB\$FB\$FB\$FB\$FB\$FB\$FB\$F6\$00\$00\$00\$00\$00\$00\$00\$00\$00\$F8\$FB\$FB\$FB\$FB\$F6\$00\$00\$00";
  222.         Name is "Send Message+";
  223.         Seed is cTokenProCommand
  224.         with
  225.             Mode is ExecuteBroadcast;
  226.             TokenRef is cTokenRef with end;
  227.             Target is cTarget with end;
  228.             Value is void;
  229.             Value1 is void;
  230.             Value2 is void;
  231.             Value3 is void;
  232.             Value4 is void;
  233.             Value5 is void;
  234.             Value6 is void;
  235.             Value7 is void;
  236.             Value8 is void;
  237.             ParameterCount is 1;
  238.             ValueRef is cLocalRef with Name is "result"; end;
  239.         end;
  240.         Words is [
  241.             cIOValueWord with Field is TokenRef; end,
  242.             cIOMenuButton 
  243.             with 
  244.                 Field is Mode; 
  245.                 TextArray is ["Broadcast", "Downwards", "Target", "Upwards"]; 
  246.                 ValueArray is [ExecuteBroadcast, ExecuteTargetDownwards, ExecuteTargetOnly, ExecuteTargetUpwards]; 
  247.                 Width is 10; 
  248.             end,
  249.             cIOWordSwitch 
  250.             with 
  251.                 Field is Mode;
  252.                 ValueArray is [ExecuteBroadcast, ExecuteTargetDownwards, ExecuteTargetOnly, ExecuteTargetUpwards]; 
  253.                 ValueIndex is 1;
  254.                 Words is [
  255.                     oIONoWordInclude,
  256.                     cIOTargetParameterWord with Field is Target; TargetType is cElement; end,
  257.                     cIOTargetParameterWord with Field is Target; TargetType is cElement; end,
  258.                     cIOTargetParameterWord with Field is Target; TargetType is cElement; end
  259.                 ];
  260.             end,
  261.             oIOSeparator,
  262.             cIORightLabel with Text is "Argument #"; Width is 9; end,
  263.             cIOMenuButton
  264.             has
  265.                 SetIndex(theItem,theIndex)
  266.                     use
  267.                         aLastIndex;
  268.                         aFieldName;
  269.                     do
  270.                         aLastIndex := self.GetIndex(theItem);
  271.                         aFieldName := ("Value" + aLastIndex.ToString()).ToMessage();
  272.                         theItem.aFieldName := theItem.Value.Clone();
  273.                         self.cIOMenuButton:SetIndex(theItem,theIndex);
  274.                         aFieldName := ("Value" + theIndex.ToString()).ToMessage();
  275.                         theItem.Value := theItem.aFieldName.Clone();
  276.                     end;
  277.                     
  278.                 GetText(theItem)
  279.                     use
  280.                         aField;
  281.                         aIndex;
  282.                     do
  283.                         aIndex := self.GetIndex(theItem);
  284.                         aField := ("Value" + aIndex.ToString()).ToMessage();
  285.                         theItem.aField := theItem.Value.Clone();
  286.                         result := self.cIOMenuButton:GetText(theItem);
  287.                     end;
  288.                     
  289.                     
  290.                 GetFieldType(theItem,theIndex)
  291.                     use
  292.                         aField;
  293.                         aValue;
  294.                         aIndex;
  295.                     do
  296.                         aField := ("Value" + theIndex.ToString()).ToMessage();
  297.                         
  298.                         aValue := theItem.(aField);
  299.                         aIndex := oIOParameterToolSeedArray.FirstThat(Conform, KERNEL.TypeOf(aValue));
  300.                         if aIndex = 0 then
  301.                             aIndex := 1;
  302.                         end;
  303.                         result := oIOParameterToolTextArray.GetAt(aIndex);
  304.                     end;
  305.                     
  306.                     
  307.                 GetTextArray(theItem)
  308.                     use
  309.                         aIndex;
  310.                     do
  311.                         result := self.TextArray.Dub();
  312.                         from
  313.                             aIndex := 1;
  314.                         loop
  315.                             result.PutAt(result.GetAt(aIndex) + " " + self.GetFieldType(theItem,aIndex),aIndex);
  316.                         step
  317.                             aIndex := aIndex + 1;
  318.                         until
  319.                             aIndex > result.Count();
  320.                             
  321.                     end;
  322.             with
  323.                 ValueArray is [1,2,3,4,5,6,7,8];
  324.                 TextArray is ["1","2","3","4","5","6","7","8"];
  325.                 Width is 12;
  326.                 Field is ParameterCount;
  327.             end,
  328.             cIORightLabel
  329.             has
  330.                 GetText(theItem)
  331.                     do
  332.                         result := self.Text + " " + theItem.ParameterCount.ToString();
  333.                     end;
  334.             with
  335.                 Text is "In"; 
  336.                 Width is 3;
  337.             end,
  338.             oIOValueTypeParameterWordInclude,
  339.             oIOSeparator,
  340.             cIORightLabel with Text is "Out"; Width is 3; end,
  341.             oIOParameterOutWord 
  342.         ];
  343.     end;
  344.  
  345. end;
  346.  
  347.  
  348.  
  349.